#ifndef __KEYBOARD_H__
#define __KEYBOARD_H__
#include "stm32f1xx_hal.h"
#include <stdint.h>
#include "xinput.h"

typedef enum KEYBOARD_KEY_INDEX
{
    KEYBOARD_KEY_UP = 0,
    KEYBOARD_KEY_DOWN,
    KEYBOARD_KEY_LEFT,
    KEYBOARD_KEY_RIGHT,
    KEYBOARD_KEY_PLUS,
    KEYBOARD_KEY_O,
    KEYBOARD_KEY_OK,
    KEYBOARD_KEY_SUB,
    KEYBOARD_KEY_MENU,
    KEYBOARD_KEY_POWER_STATUS,
    KEYBOARD_KEY_MAX
} KEYBOARD_KEY_INDEX;

typedef enum KEYBOARD_POWER_KEY
{
    POWER_KEY_OFF = 0,
    POWER_KEY_ON
}KEYBOARD_POWER_KEY;

extern int16_t leftTriggerValue_ADC;
extern int16_t rightTriggerValue_ADC;
extern int16_t xLeftStickValue_ADC;
extern int16_t yLeftStickValue_ADC;
extern int16_t xRightStickValue_ADC;
extern int16_t yRightStickValue_ADC;

extern int16_t leftTriggerValue;
extern int16_t rightTriggerValue;
extern int16_t xLeftStickValue;
extern int16_t yLeftStickValue;
extern int16_t xRightStickValue;
extern int16_t yRightStickValue;

int32_t keyboard_init();
int8_t get_key_status(KEYBOARD_KEY_INDEX index);
void power_key_ctrl(KEYBOARD_POWER_KEY cmd);
void updateSticks();
void readAdcValues();
void readButtons();

#endif
